DEW.HomeController = function() {};

$.extend(DEW.HomeController.prototype, {
    render: function() {
        DEW.ViewManager.removeAll();
        this.displayLayout();
        this.displayHeader();
        this.displayBody();
        
        
    },

    displayLayout: function() {
        var baseLayout = new DEW.BaseLayout();
        baseLayout.render();
        $("#content").html(baseLayout.el);
        
        DEW.ViewManager.addView(baseLayout);
    },

    displayHeader: function() {
        var header = new DEW.Header();
        header.render();
        /* $(header.el).appendTo("#header"); */
        $("#header").html(header.el);
        
        
        var login = new DEW.Login();        
        $("#btnLogin").click(function(){
            DEW.ViewManager.remove(body);
            login.render();
            
            $(".page-content").html(login.el);
            DEW.ViewManager.addView(login);
        });
        
        
        var register = new DEW.Register();        
        $("#btnResgistrate").click(function(){
            debugger;
            DEW.ViewManager.remove(register);
            register.render();
            
            $(".page-content").html(register.el);
            DEW.ViewManager.addView(register);
        });
        
        
        DEW.ViewManager.addView(header);
    },

    displayBody: function() {
        
       
        
        var body = new DEW.Body();
        body.render();       
        /* $(body.el).appendTo(".page-content"); */
        $(".page-content").html(body.el);      
        DEW.ViewManager.addView(body);
        
    }


});